import axios from '@/plugins/axios';
const BASE_API = import.meta.env.VITE_APP_BASE_APIURL as string;

import { CommontTypes, ResponseVo, CarouselTypes, PageResult } from '@/type';

export namespace CarouselService {
  export const findAll = async (params:any): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/carousel/findAll',{params,baseURL: BASE_API});
    return res;
  };

  export const addCarousel = async (data:CarouselTypes.CarouselItem): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/carousel/add',data,{baseURL: BASE_API});
    return res;
  };

  export const editCarousel = async (data:CarouselTypes.CarouselItem): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/carousel/update',data,{baseURL: BASE_API});
    return res;
  };

  export const deleteItem = async (id:number): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/carousel/delete',{params:{id}, baseURL: BASE_API});
    return res;
  };

  export const itemizeList = async (type:string): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/itemize/list',{params:{type}, baseURL: BASE_API});
    return res;
  };
  
}
